#pragma once
ref class RenderTarget
{
internal:
    RenderTarget(
        bool createDepthStencilBuffer = false,
        bool hasRelativeSize = true,
        float width = 1.0f,
        float height = 1.0f,
        DXGI_FORMAT format = DXGI_FORMAT_B8G8R8A8_UNORM,
        DXGI_FORMAT depthStencilFormat = DXGI_FORMAT_D24_UNORM_S8_UINT
        );

    void                                Create(ID3D11Device* device, float backBufferWidth, float backBufferHeight);
    void                                Reset(void) { m_renderTargetView.Reset(); m_shaderResourceView.Reset(); m_depthStencilView.Reset(); }

    ID3D11RenderTargetView* const*      GetRenderTargetView(void) { return m_renderTargetView.GetAddressOf(); }
    ID3D11ShaderResourceView* const*    GetShaderResourceView(void) { return m_shaderResourceView.GetAddressOf(); }
    ID3D11DepthStencilView*             GetDepthStencilView(void) { return m_depthStencilView.Get(); }

protected private:
    bool                                                    m_hasDepthStencilBuffer;
    bool                                                    m_hasRelativeSize;
    float                                                   m_width;
    float                                                   m_height;
    DXGI_FORMAT                                             m_format;
    DXGI_FORMAT                                             m_depthStencilFormat;

    Microsoft::WRL::ComPtr<ID3D11RenderTargetView>          m_renderTargetView;
    Microsoft::WRL::ComPtr<ID3D11ShaderResourceView>        m_shaderResourceView;
    Microsoft::WRL::ComPtr<ID3D11DepthStencilView>          m_depthStencilView;
};

